package com.gy.niuer.mapper;

import com.gy.niuer.domain.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper {

    @Select("insert into user(id,name,id_card,phone,state) values(#{id},#{name},#{id_card},#{phone},#{state})")
    void addUser(User user);

    @Results({
            @Result(id = true,column = "id",property = "id"),
            @Result(column = "id_card",property = "idCard")
    })
    @Select("select * from user where id_card = #{id_card} and name = #{name}")
    User queryUser(String id_card, String name);

    @Results({
            @Result(id = true,column = "id",property = "id"),
            @Result(column = "id_card",property = "idCard")
    })
    @Select("select * from user where id_card = #{id_card}")
    User selectUserById(String id_card);
}
